<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>修改菜单权限</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="../../css/oksub.css">
	<script type="text/javascript" src="../../lib/loading/okLoading.js"></script>
</head>
<body>
<div class="ok-body">
	<!--form表单-->
	<form class="layui-form ok-form" lay-filter = "permission">
		<input type="hidden" name="menuId" value="">

		<div class="layui-form-item">
			<label class="layui-form-label">菜单名称</label>
			<div class="layui-input-block">
				<input type="text" name="title" placeholder="请输入菜单名称" autocomplete="off" class="layui-input layui-disabled" lay-verify="required">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">菜单类型</label>
			<div class="layui-input-block layui-disabled">
				<input type="radio" name="type" value="M" title="目录" lay-filter="type">
				<input type="radio" name="type" value="C" title="菜单" lay-filter="type">
				<input type="radio" name="type" value="F" title="按钮" lay-filter="type">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">权限</label>
			<div class="layui-input-block">
				<select name="permissionId" id="permissionId" lay-verify="required"></select>
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit lay-filter="perms">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>
</div>
<!--js逻辑-->
<script src="../../lib/layui/layui.js"></script>
<script src="../../libme/script/tgfApi.js"></script>
<script src="../../libme/pages/main.js"></script>
<script type="text/javascript">
	layui.use(['element', 'form', 'jquery', "okLayer", "okUtils", "okMock"], function () {
		var element = layui.element;
		var form = layui.form;
		var $ = layui.jquery;
        let okLayer = layui.okLayer;
        let okUtils = layui.okUtils;
        let okMock = layui.okMock;

		okLoading.close();
		form.on('submit(perms)', function (data) {
			//console.log(data.field);
			$.ajax({
				url: okMock.api.menu.rePerms,
				data: data.field,
				dataType:JSONTYPE,
				type:'post',
				success: function (resp, stat) {
				    if(resp.code == RESP_SUCCESS){
						layer.msg("编辑成功！", {icon: 6, time: 1000, anim: 4}, function () {
							parent.layer.close(parent.layer.getFrameIndex(window.name));
						});
					}
                }
			})
			return false;
		});

        $(function () {//页面加载
        })
	})
</script>
</body>
</html>
